/*
 * Created on 2007-9-5
 *
 * TODO To change the template for this generated file go to
 * Window - Preferences - Java - Code Style - Code Templates
 */
package com.tongji.quickCRUDQ.html;

import com.tongji.quickCRUDQ.define.Column;
import com.tongji.quickCRUDQ.util.Constant;

/**
 * @author Administrator
 *
 * TODO To change the template for this generated type comment go to
 * Window - Preferences - Java - Code Style - Code Templates
 */
public class Date implements Control {

	private Object dynamic;

	/* (non-Javadoc)
	 * @see com.tongji.quickCRUDQ.html.Control#setDynamic(java.lang.Object)
	 */
	public void setDynamic(Object dynamic) {
		this.dynamic=dynamic;
	}
	/* (non-Javadoc)
	 * @see com.tongji.quickCRUDQ.html.Control#setStyleClass(java.lang.String)
	 */
	public void setStyleClass(String value) {
		// TODO Auto-generated method stub

	}

	/* (non-Javadoc)
	 * @see com.tongji.quickCRUDQ.html.Control#formatDetailHtml(java.lang.String, com.tongji.quickCRUDQ.define.Column)
	 */
	public String formatDetailHtml(String value, Column column) {
		StringBuffer html=new StringBuffer();
//		value=StringUtil.NVL(value,"").substring(0,10);
		html.append("<script>");
		html.append("var date_").append(column.getColumnname()).append("=createDate(\"")
		.append(column.getColumnname()).append("\"");
		if(value!=null&&value.equals(Constant.NULL_IN_HTML)==false&&value.equals("")==false) html.append(",false,\"").append(value).append("\"");
		html.append(");date_").append(column.getColumnname()).append(".hideInput.bnull=\"").append(column.getBnull()).append("\"</script>");
		return html.toString();
	}

	/* (non-Javadoc)
	 * @see com.tongji.quickCRUDQ.html.Control#formatTableHtml(java.lang.String, com.tongji.quickCRUDQ.define.Column)
	 */
	public String formatTableHtml(String value, Column column) {
		return value;
	}

}
